<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <form id="advanced_total_formulaForm" class="m5">
        <div>
            学期：
                <select class="easyui-combobox" name="termId" id="termId" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onSelect:changeTerm"></select>
                <select id="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto',url:'/compent/Util/gradeNameList',onSelect:changeGrade">
                </select>
                <select id="examId" class="easyui-combobox" data-options="width:120,panelHeight:'auto',editable:false"></select>
                <select id="clazzType" class="easyui-combobox" data-options="width:80,panelHeight:'auto'">
                <option value="">请选择</option>
                <option value="0">天佑班</option>
                <option value="1">有为班</option>
                <option value="2">火箭班</option>
                <option value="3">国际部</option>
            </select>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('advanced_total_formula')">查询</a>
            <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm1('advanced_total_formula')">重置</a>
        </div>
    </form>
    <table id="advanced_total_formuladg">
        <thead>
            <tr>
                <th data-options="field:'ID',checkbox:true">ID</th>
                <th data-options="field:'考试ID',title:'考试名称',width:20,formatter:function(value,row,index){
                    return row.考试名称;
                }"></th>
                <th data-options="field:'年级ID',title:'年级',width:20,editor:{type:'combobox',options:{
                required:true,
                url:'/compent/Util/gradeNameList.html'
                }},formatter:function(value,row,index){
                    return row.年级名称;
                }"></th>
                <th data-options="field:'班级层次',title:'班级层次',width:20,editor:{type:'combobox',options:{required:true,
                data:[{'value':'0','text':'天佑班'},{'value':'1','text':'有为班'},{'value':'2','text':'火箭班'},{'value':'3','text':'国际班'}]
                }},
                formatter: function(value, row, index) {
                    if(value == 0) return '天佑班';
                    else if(value == 1) return '有为班';
                    else if(value == 2) return '火箭班';
                    else if(value == 3) return '国际班';
                    return '';
                }"></th>
                <th data-options="field:'培优分段',title:'培优分段',width:40,editor:{type:'textbox',options:{required:true,multiline:true}},
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+value+'\'>'+ value + '</span>';
                }"></th>
                <th data-options="field:'公式',title:'培优总分公式',width:40,editor:{type:'textbox',options:{required:true,multiline:true}},
                formatter: function(value, row, index) {
                    return '<span class=\'note\' title=\''+value+'\'>'+ value + '</span>';
                }"></th>
            </tr>
        </thead>
    </table>

    <script type="text/javascript">
        $(function(){
            var url = "/examScore/advanced_total_formula";
            initDatagridAdmin("advanced_total_formula",url,0,0,1,1,0);
        })  

        function changeTerm(record){
            var gradeId = $('#gradeId').combobox('getValue');
            if(gradeId) {
                var url="/compent/util/getTermExam?termId="+record.ID+"&grade="+gradeId;
                $('#examId').combobox('setValue','');
                $('#examId').combobox('reload',url);
            }
        }
        function changeGrade(record) {
            var termId = $('#termId').combobox('getValue');
            var url="/compent/util/getTermExam?termId="+termId+"&grade="+record.value;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
        }

        function queryOk(){
            var examId = $('#examId').combobox('getValue');
            var clazzType = $('#clazzType').combobox('getValue');
            $('#advanced_total_formuladg').datagrid('load',{examId:examId,clazzType:clazzType});
        }
        function resetForm1(cf){
            $("#" + cf + "Form #termId").combobox('setValue', null);
            $("#" + cf + "Form #gradeId").combobox('setValue', null);
            $("#" + cf + "Form #examId").combobox('setValue', null);
            $("#" + cf + "Form #clazzType").combobox('setValue', "");
        }
    </script>
</body>
</html>